home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1988 / Jun 88 / re NewPaletteWindow 6⁄6 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.5 KB  |  37 lines  |  [TEXT/GEOL]

  1. Item    8834373                         6-June-88        10:52
  2.  
  3. From:   ROSENSTEIN1                     Rosenstein, Larry
  4.  
  5. To:     D1157                           All Star Computer, Dev, L Goldman
  6.  
  7. cc:     MACAPP$                         MacApp Interest List
  8.  
  9. Sub:    re NewPaletteWindow Bug
  10.  
  11. I think you are right on both accounts.
  12.  
  13. Only the topLeft of r is significant because the main frame will be resized to
  14. the correct size TWindow.Resize is called.  But you are right in that some
  15. debugging utilities check for invalid rectangles such as this.
  16.  
  17. The second bug is really a bug; it should be subtracting topLeft from wSize.
  18. As you say, topLeft is always (0,0), so thePort is not damaged and the window
  19. is resized properly.
  20.  
  21. I still think it is safer not to assume that the portRect.topLeft is (0,0)
  22. since the call to the Window Manager is not being made in NewPaletteWindow.  It
  23. is conceivable (although unlikely) that someone would make a change to
  24. NewTWindow that would change the topLeft.  I hesitate to make code that depends
  25. on assumptions about how other procedure work (such as this).
  26.  
  27. One way to do this, however, would be to assume that the portRect.topLeft was
  28. (0,0) and do a check when debugging code was turned on to make sure this was
  29. true.  If it wasn't true, call ProgramBreak to alert the programmer and offset
  30. the portRect so it was true.  That way if someone changes NewTWindow to violate
  31. the assumption it will be noticed.  (This kind of technique is used throughout
  32. MacApp and is a good example of 'defensive programming'.)
  33.  
  34. Larry Rosenstein.
  35.  
  36.  
  37.